import axios from "axios";

const instance = axios.create({
  // baseURL: "http://localhost:8101/api/",
  baseURL: "http://8.130.44.72:8101/api/",
  // baseURL: "http://8.140.54.254:8101/api/",
  timeout: 10000,
  headers: {},
});
instance.defaults.withCredentials = true;
// 添加响应拦截器
instance.interceptors.response.use(
  function (response) {

    const data = response.data
    // console.log(data);
    if(data.code === 0 ){
      return data.data;
    }
    // console.error('request error',data.data);
    return data.data;
  },
  function (error) {
    // 对响应错误做点什么
    return Promise.reject(error);
  }
);


export default instance;
